<template>
  <el-dialog
    width="100%"
    :fullscreen="true"
    top="0"
    :title="'显示详情'"
    :close-on-click-modal="false"
    :visible.sync="visible">
    <el-form :model="dataForm"  ref="dataForm"   label-width="80px">
 
 
 

  <el-row >
      <el-col :span="6"><font class="label_font">查询时间： </font></el-col>
      <el-col :span="6">{{dataForm.qrytime}} </el-col>
      <el-col :span="6"><font class="label_font">不动产单元号：</font></el-col>
      <el-col :span="6">{{dataForm.realtyunitno}}</el-col>
  </el-row>

  <el-row>
      <el-col :span="12"><font class="label_font">区域： </font> {{dataForm.region}} </el-col>
      <el-col :span="12"><font class="label_font">不动产权证号：</font>{{dataForm.realtycertno}}</el-col>
  </el-row>
  <el-row>
      <el-col :span="12"><font class="label_font">被抵押次数： </font> {{dataForm.pledgecount}} </el-col>
      <el-col :span="12"><font class="label_font">被查封次数：</font>{{dataForm.sealedcount}}</el-col>
  </el-row>
  <el-row>
      <el-col :span="12"><font class="label_font">区域： </font> {{dataForm.region}} </el-col>
      <el-col :span="12"><font class="label_font">不动产权证号：</font>{{dataForm.realtycertno}}</el-col>
  </el-row>



    <el-form-item label="是否存在抵押权预告登记" prop="ismortgageprereg">
      <el-input v-model="dataForm.ismortgageprereg" placeholder="是否存在抵押权预告登记"></el-input>
    </el-form-item>
    <el-form-item label="是否存在预告登记" prop="isprereg">
      <el-input v-model="dataForm.isprereg" placeholder="是否存在预告登记"></el-input>
    </el-form-item>
    <el-form-item label="是否存在异议登记" prop="isdissentreg">
      <el-input v-model="dataForm.isdissentreg" placeholder="是否存在异议登记"></el-input>
    </el-form-item>
    <el-form-item label="是否存在居住权" prop="isjzq">
      <el-input v-model="dataForm.isjzq" placeholder="是否存在居住权"></el-input>
    </el-form-item>
    <el-form-item label="带抵押转让标识" prop="isdygh">
      <el-input v-model="dataForm.isdygh" placeholder="带抵押转让标识"></el-input>
    </el-form-item>
    <el-form-item label="房屋坐落" prop="location">
      <el-input v-model="dataForm.location" placeholder="房屋坐落"></el-input>
    </el-form-item>
    <el-form-item label="土地性质" prop="landtype">
      <el-input v-model="dataForm.landtype" placeholder="土地性质"></el-input>
    </el-form-item>
    <el-form-item label="土地使用权结束日期" prop="landenddate">
      <el-input v-model="dataForm.landenddate" placeholder="土地使用权结束日期"></el-input>
    </el-form-item>
    <el-form-item label="房屋建筑面积" prop="buildingarea">
      <el-input v-model="dataForm.buildingarea" placeholder="房屋建筑面积"></el-input>
    </el-form-item>
    <el-form-item label="房屋套内面积" prop="insidearea">
      <el-input v-model="dataForm.insidearea" placeholder="房屋套内面积"></el-input>
    </el-form-item>
    <el-form-item label="房屋公摊面积" prop="publicarea">
      <el-input v-model="dataForm.publicarea" placeholder="房屋公摊面积"></el-input>
    </el-form-item>
    <el-form-item label="土地分摊面积" prop="publiclandarea">
      <el-input v-model="dataForm.publiclandarea" placeholder="土地分摊面积"></el-input>
    </el-form-item>
    <el-form-item label="房屋用途" prop="landusge">
      <el-input v-model="dataForm.landusge" placeholder="房屋用途"></el-input>
    </el-form-item>

    <el-form-item label="备注" prop="remark">
      <el-input v-model="dataForm.remark" placeholder="备注"></el-input>
    </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    data () {
      return {
        visible: false,
        dataForm: {
          serialno: 0,
          seqno: '',
          id: '',
          qrytime: '',
          authcode: '',
          obankid: '',
          region: '',
          realtyunitno: '',
          realtycertno: '',
          pledgecount: '',
          sealedcount: '',
          ismortgageprereg: '',
          isprereg: '',
          isdissentreg: '',
          isjzq: '',
          isdygh: '',
          location: '',
          landtype: '',
          landenddate: '',
          buildingarea: '',
          insidearea: '',
          publicarea: '',
          publiclandarea: '',
          landusge: '',
          isdyrset: '',
          remark: ''
        },
        dataRule: {
          seqno: [
            { required: true, message: '全局序号不能为空', trigger: 'blur' }
          ],
          id: [
            { required: true, message: '多条记录,递增不能为空', trigger: 'blur' }
          ],
          qrytime: [
            { required: true, message: '查询时间不能为空', trigger: 'blur' }
          ],
          authcode: [
            { required: true, message: '授权码:存放网厅授权码/委托授权书编号,在请求报文中2个条件只能选一不能为空', trigger: 'blur' }
          ],
          obankid: [
            { required: true, message: '抵押权人机构代码(发起网点号)不能为空', trigger: 'blur' }
          ],
          region: [
            { required: true, message: '区划代码不能为空', trigger: 'blur' }
          ],
          realtyunitno: [
            { required: true, message: '不动产单元号不能为空', trigger: 'blur' }
          ],
          realtycertno: [
            { required: true, message: '不动产权证号不能为空', trigger: 'blur' }
          ],
          pledgecount: [
            { required: true, message: '被抵押次数不能为空', trigger: 'blur' }
          ],
          sealedcount: [
            { required: true, message: '被查封次数不能为空', trigger: 'blur' }
          ],
          ismortgageprereg: [
            { required: true, message: '是否存在抵押权预告登记不能为空', trigger: 'blur' }
          ],
          isprereg: [
            { required: true, message: '是否存在预告登记不能为空', trigger: 'blur' }
          ],
          isdissentreg: [
            { required: true, message: '是否存在异议登记不能为空', trigger: 'blur' }
          ],
          isjzq: [
            { required: true, message: '是否存在居住权不能为空', trigger: 'blur' }
          ],
          isdygh: [
            { required: true, message: '带抵押转让标识不能为空', trigger: 'blur' }
          ],
          location: [
            { required: true, message: '房屋坐落不能为空', trigger: 'blur' }
          ],
          landtype: [
            { required: true, message: '土地性质不能为空', trigger: 'blur' }
          ],
          landenddate: [
            { required: true, message: '土地使用权结束日期不能为空', trigger: 'blur' }
          ],
          buildingarea: [
            { required: true, message: '房屋建筑面积不能为空', trigger: 'blur' }
          ],
          insidearea: [
            { required: true, message: '房屋套内面积不能为空', trigger: 'blur' }
          ],
          publicarea: [
            { required: true, message: '房屋公摊面积不能为空', trigger: 'blur' }
          ],
          publiclandarea: [
            { required: true, message: '土地分摊面积不能为空', trigger: 'blur' }
          ],
          landusge: [
            { required: true, message: '房屋用途不能为空', trigger: 'blur' }
          ],
          isdyrset: [
            { required: true, message: '是否存在抵押人信息:1-存在;0-不存在不能为空', trigger: 'blur' }
          ],
          remark: [
            { required: true, message: '备注不能为空', trigger: 'blur' }
          ]
        }
      }
    },
    methods: {
      init (id) {
        this.dataForm.serialno = id || 0
        this.visible = true
        this.$nextTick(() => {
          this.$refs['dataForm'].resetFields()
          if (this.dataForm.serialno) {
            this.$http({
              url: this.$http.adornUrl(`/bdc/bdcrealtyunit/info/${this.dataForm.serialno}`),
              method: 'get',
              params: this.$http.adornParams()
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.dataForm.seqno = data.bdcRealtyunit.seqno
                this.dataForm.id = data.bdcRealtyunit.id
                this.dataForm.qrytime = data.bdcRealtyunit.qrytime
                this.dataForm.authcode = data.bdcRealtyunit.authcode
                this.dataForm.obankid = data.bdcRealtyunit.obankid
                this.dataForm.region = data.bdcRealtyunit.region
                this.dataForm.realtyunitno = data.bdcRealtyunit.realtyunitno
                this.dataForm.realtycertno = data.bdcRealtyunit.realtycertno
                this.dataForm.pledgecount = data.bdcRealtyunit.pledgecount
                this.dataForm.sealedcount = data.bdcRealtyunit.sealedcount
                this.dataForm.ismortgageprereg = data.bdcRealtyunit.ismortgageprereg
                this.dataForm.isprereg = data.bdcRealtyunit.isprereg
                this.dataForm.isdissentreg = data.bdcRealtyunit.isdissentreg
                this.dataForm.isjzq = data.bdcRealtyunit.isjzq
                this.dataForm.isdygh = data.bdcRealtyunit.isdygh
                this.dataForm.location = data.bdcRealtyunit.location
                this.dataForm.landtype = data.bdcRealtyunit.landtype
                this.dataForm.landenddate = data.bdcRealtyunit.landenddate
                this.dataForm.buildingarea = data.bdcRealtyunit.buildingarea
                this.dataForm.insidearea = data.bdcRealtyunit.insidearea
                this.dataForm.publicarea = data.bdcRealtyunit.publicarea
                this.dataForm.publiclandarea = data.bdcRealtyunit.publiclandarea
                this.dataForm.landusge = data.bdcRealtyunit.landusge
                this.dataForm.isdyrset = data.bdcRealtyunit.isdyrset
                this.dataForm.remark = data.bdcRealtyunit.remark
              }
            })
          }
        })
      },
      // 表单提交
      dataFormSubmit () {
        this.$refs['dataForm'].validate((valid) => {
          if (valid) {
            this.$http({
              url: this.$http.adornUrl(`/bdc/bdcrealtyunit/${!this.dataForm.serialno ? 'save' : 'update'}`),
              method: 'post',
              data: this.$http.adornData({
                'serialno': this.dataForm.serialno || undefined,
                'seqno': this.dataForm.seqno,
                'id': this.dataForm.id,
                'qrytime': this.dataForm.qrytime,
                'authcode': this.dataForm.authcode,
                'obankid': this.dataForm.obankid,
                'region': this.dataForm.region,
                'realtyunitno': this.dataForm.realtyunitno,
                'realtycertno': this.dataForm.realtycertno,
                'pledgecount': this.dataForm.pledgecount,
                'sealedcount': this.dataForm.sealedcount,
                'ismortgageprereg': this.dataForm.ismortgageprereg,
                'isprereg': this.dataForm.isprereg,
                'isdissentreg': this.dataForm.isdissentreg,
                'isjzq': this.dataForm.isjzq,
                'isdygh': this.dataForm.isdygh,
                'location': this.dataForm.location,
                'landtype': this.dataForm.landtype,
                'landenddate': this.dataForm.landenddate,
                'buildingarea': this.dataForm.buildingarea,
                'insidearea': this.dataForm.insidearea,
                'publicarea': this.dataForm.publicarea,
                'publiclandarea': this.dataForm.publiclandarea,
                'landusge': this.dataForm.landusge,
                'isdyrset': this.dataForm.isdyrset,
                'remark': this.dataForm.remark
              })
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.$message({
                  message: '操作成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {
                    this.visible = false
                    this.$emit('refreshDataList')
                  }
                })
              } else {
                this.$message.error(data.msg)
              }
            })
          }
        })
      }
    }
  }
</script>
